package com.hexb.smh.entity;

import com.fasterxml.jackson.annotation.JsonRawValue;
import com.hexb.smh.entity.view.ProductSumView;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @author : hexb
 */
@Data
public class EvaluateHistory {

    private Integer id;

    @JsonRawValue
    private String productSnapshot;

    private BigDecimal fixedSum;
    private BigDecimal volatileSum;
    private BigDecimal otherSum;
    private BigDecimal marketSum;
    private BigDecimal dealPrice;
    private BigDecimal commissionRate;

    private String evaluateLevel;
    private Boolean passed;
    private BigDecimal evaluateScore;
    private Date createTime;
    private Integer accountId;
    private Integer brandId;

    public void fill(ProductSumView sum) {
        this.fixedSum = sum.getFixedCostTotal();
        this.volatileSum = sum.getVolatileCostTotal();
        this.otherSum = sum.getOtherCostTotal();
        this.marketSum = sum.getMarketTotal();
    }

    public void fill(EvaluateLevel level) {
        this.evaluateLevel = level.getLevelName();
        this.passed = level.getPassed();
    }
}
